﻿using OpenTK.Graphics.OpenGL4;

namespace TrinityEngine
{
    public static class Quad
    {
        private static readonly float NegHalf = -0.5f;

        private static readonly float PosHalf = 0.5f;

        private static readonly int Zero = 0;

        private static readonly int One = 1;

        private static readonly float[] DATAS = new[] {
            NegHalf, NegHalf, Zero, Zero,
            NegHalf, PosHalf, Zero, One,
            PosHalf, PosHalf, One, One,
            PosHalf, PosHalf, One, One,
            PosHalf, NegHalf, One, Zero,
            NegHalf, NegHalf, Zero, Zero
        };

        private static readonly int _vbo;

        static Quad()
        {
            _vbo = GL.GenBuffer();
            GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo);
            GL.BufferData(BufferTarget.ArrayBuffer, DATAS.Length * sizeof(float), DATAS, BufferUsageHint.StaticDraw);
        }

        public static void Call() { }

        public static void Use()
        {
            GL.BindBuffer(BufferTarget.ArrayBuffer, _vbo);
        }
    }
}
